package com.jy.appmarket.utils;

import java.io.File;

import android.content.Context;
import android.os.Environment;

/**
 * 类说明：
 * 
 * @author xinhui.cheng
 * @date 2013-10-28
 * @version 1.0
 */
public class Config {

	/** SD卡目录 */
	public static String SDCARD_DIR = Environment.getExternalStorageDirectory()
			.getAbsolutePath();
	public static final String SOME_COOLPAD_SDCARD_DIR = "/mnt/internal";
	static {
		if(!Environment.getExternalStorageDirectory().exists() 
				&& new File(SOME_COOLPAD_SDCARD_DIR).exists()) {
			SDCARD_DIR = SOME_COOLPAD_SDCARD_DIR;
		}
	}

	/** 软件根目录 */
	public static String ROOT_DIR = SDCARD_DIR + "/appMarket";

	/** 下载根目录 */
	public static String DOWNLOAD_DIR = ROOT_DIR + "/download";
	
	/** 更新根目录*/
	public static String UPDATE_DIR = ROOT_DIR + "/update";

	/** 缓存根目录 */
	public static String CACHE_DIR = ROOT_DIR + "/cache";

	public static String ZIP_DIR = ROOT_DIR + "/zip";
	
	public static String WALLPAPER_DIR = ROOT_DIR + "/wallpaper";
	
//	public static String BANK_IMAGE_URL = "http://218.17.158.203:8081/wangcai-service/images/";
//	
//	public static final String BROADCAST_ACTION = "com.android.wangcai.newpush";
	
	public static void setCacheDir(Context ctx) {
		File sdcard = new File(SDCARD_DIR);
		if(!sdcard.exists() || !sdcard.canWrite()) {
			File cache = ctx.getCacheDir();
			if(!cache.exists()) {
				cache.mkdir();
			}
			CACHE_DIR = cache.getAbsolutePath() + "/appMarket" + "/cache";
		}
	}
}
